import { ref, computed } from 'vue'
import { defineStore } from 'pinia'

export interface FormSetting {
    [key: string]: string | number | boolean | undefined
}
export interface QuestionSetting {
    [key: string]: FormSetting;
}
export const useQuestionStore = defineStore('question', {

    state: () => ({
        questionSetting: {} as QuestionSetting,
    }),
    getters: {
        // 这里可以定义一些计算属性
        getQuestionSetting: (state) => state.questionSetting,
    },
    actions: {
        setQuestionSetting(id: string, key: string, v: any) {
            this.questionSetting[id][key] = v;
        },
        initQuestionSetting(id: string, form: FormSetting) {
            this.questionSetting[id] = form
        },
    },
}
)
